package cn.tedu.egmvc2.controller;

import ch.qos.logback.core.joran.util.beans.BeanUtil;
import cn.tedu.egmvc2.mapper.AddressMapper;
import cn.tedu.egmvc2.pojo.entity.Address;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/address/")
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;

    @RequestMapping("insert")
    public String insert(Address address){
        addressMapper.insertAddress(address);
        return "插入成功";
    }
    @RequestMapping("select")
    public List<Address> select(){

        return  addressMapper.selectAddress();


    }
    @RequestMapping("delete")
    public  String delete(int id){
        addressMapper.deleteAddress(id);
        return "删除成功";

    }
    @RequestMapping("update")
    public String update(Address address){
        addressMapper.updateAddress(address);
        return "更新成功";
    }


}
